import React from "react";
//引入路由
import { NavLink, useRoutes } from "react-router-dom";
import Header from "./component/Header";
import routes from "./routes";
//引入一般组件   对NavLink的封装
export default function App() {
  //注册路由表
  const element = useRoutes(routes);

  return (
    <div>
      <div className="row">
        <div className="col-xs-offset-2 col-xs-8">
          <div className="page-header">
            <Header />
          </div>
        </div>
      </div>
      <div className="row">
        <div className="col-xs-2 col-xs-offset-2">
          <div className="list-group">
            {/* react路由跳转 */}
            <NavLink className="list-group-item" to={"/home"}>
              Home页面
            </NavLink>
            <NavLink className="list-group-item" to={"/about"}>
              About页面
            </NavLink>
          </div>
        </div>
        <div className="col-xs-6">
          <div className="panel">
            <div className="panel-body">{element}</div>
          </div>
        </div>
      </div>
    </div>
  );
}
